/**
 * 
 */
package org.cuatrovientos.es;

import java.util.Random;

/**
 * exercice tema06 clases 2
 * a class dice 
 * @author daniel_ancin
 *
 */
public class Dice {

	private int sides;
	private boolean admiteCero = true;
			
	/**
	 *Constructor 
	 * @return
	 */
	 public Dice (){
		sides= 6;
	 }
	 
	 /**
	  * constructor that gives values
	  * @param sides
	  * @param admiteCero
	  */
	 public Dice (int sides, boolean admiteCero){
		this.sides=sides;
		this.admiteCero=admiteCero;
				
	 }
	
	/**
	 * Roll the Dice
	 * @return
	 */
		public int rollTheDice (){
			Random random = new Random();
			if (admiteCero == true) {
				return random.nextInt(sides);
			}
				else  {
				return random.nextInt(sides)+1;
			}
		}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
			
		Dice myDice=new Dice(5,true);
		System.out.println(myDice.rollTheDice());
		
		}
	}